.toc {
  width: 100%;
  max-width: $sidebar-width;
  position: fixed;
  top: 7rem;
  font-size: 0.85rem;
  padding-left: 0.5rem;
  z-index: z('toc');

  &[data-ani="true"] {
    @include animation('slide-in-down-little .2s .3s 1 ease-in backwards');
  }

  @include no-select;
  
  #TableOfContents {
    position: relative;
  }

  &__flexbox[data-position="fixed"] {
    @include flexbox();
    @include align-items(center);
    position: fixed;

    .toc__title {
      margin-top: 0.75rem;
      margin-left: 0.5rem;
    }
  }

  &__flexbox[data-position="absolute"] {
    @include flexbox();
    @include align-items(center);
    position: absolute;
  }

  &__flexbox--outer[data-position="fixed"] {
    @include flexbox();
    @include align-items(center);
    top: 4.2rem;
    left: 1rem;
    position: absolute;
    
    @media only screen and (max-width: 1300px) {
      display: none;
    }

    &[data-ani="true"] {
      @include animation('slide-in-down-little .2s .3s 1 ease-in backwards');
    }
  }

  &__flexbox--outer[data-dir="ltr"] {
    top: 4.2rem;
    left: 1rem;
  }

  &__flexbox--outer[data-dir="rtl"] {
    top: 4.2rem;
    right: 1rem;

    .toc__title {
      margin-top: 0.75rem;
      margin-left: 0.5rem;
    }
  }

  &__title {
    font-size: 0.9rem;
    margin-top: 0.5rem;

    &[data-ani="true"] {
      @include animation('slide-in-down-little .2s .3s 1 ease-in backwards');
    }
    
    @include themify($themes) {
      color: themed('toc-label-color');
    }

    &--outer {
      @media only screen and (max-width: 1300px) {
        display: none;
      }
    }
  }

  &[data-dir="ltr"] {
    &[data-folding=true] {
      @include themify($themes) {
        a {
          color: themed('toc-vertical-line');
          position: relative;

          &::before {
            content: '';
            height: 100%;
            left: -1rem;
            margin-top: -1px;
            position: absolute;
            width: 2px;            
            background-color: themed('toc-vertical-line');
            &:last-child {
              background-color: transparent;
            }
          }
        }
          
        .active {
          color: themed('toc-vertical-line-active');
          font-weight: 700;
          &::before {
            background-color: themed('toc-vertical-line-active');
          }
        }
      }
    }

    &[data-folding=false] {
      @include themify($themes) {
        a {
          color: themed('toc-vertical-line');

          &.active {
            color: themed('toc-vertical-line-active');
            
            &::before {
              background-color: themed('toc-vertical-line-active');
              content: '';
              height: 0.95rem;
              left: -1rem;
              margin-top: 2px;
              position: absolute;
              width: 2px;            
              &:last-child {
                background-color: transparent;
              }
            }
          }
        }   
      }
    }

    ul {
      @include themify($themes) {
        li {        
          li {
            margin-left: 1rem;
            color: themed('sidebar-li-color');      
          }  
        }
      }
    }
  }

  &[data-dir="rtl"] {
    &[data-folding=true] {
      a {
        color: inherit;
        position: relative;
        &::before {
          @include themify($themes) {        
            background-color: themed('toc-vertical-line');
          }      
          content: '';
          height: 100%;
          right: -1rem;
          margin-top: -1px;
          position: absolute;
          width: 2px;            
          &:last-child {
            background-color: transparent;
          }
        }
      }

      .active {
        @include themify($themes) {
          color: themed('link-hover');
          font-weight: 700;
          &::before {        
            background-color: themed('toc-vertical-line-active');
          }
        }
      }
    }

    &[data-folding=false] {
      @include themify($themes) {
        a {
          color: themed('toc-vertical-line');

          &.active {
            color: themed('toc-vertical-line-active');
            
            &::before {
              background-color: themed('toc-vertical-line-active');
              content: '';
              height: 0.95rem;
              right: -1rem;
              margin-top: 2px;
              position: absolute;
              width: 2px;            
              &:last-child {
                background-color: transparent;
              }
            }
          }
        }   
      }
    }

    ul {
      @include themify($themes) {
        li {
          li {
            margin-right: 1rem;
            color: themed('sidebar-li-color');      
          }  
        }
      }
    }
  }

  ul {
    @include themify($themes) {
      a {
        color: themed('toc-title-color');        
        &.active {
          color: themed('toc-vertical-line-active');
        }
      }
    }
  }

  &__outer {
    padding-right: 1rem;
    padding-left: 2.5rem;
    max-width: calc((100vw - 980px) / 2);

    @media only screen and (max-width: 1300px) {
      display: none;
    }
  }
}

.expand__content {
  #TableOfContents {
    ul {
      list-style-type: circle;
    }
  }
}